package cn.edu.ctbu.studentmanage.controller;
import cn.edu.ctbu.studentmanage.domain.Course;
import cn.edu.ctbu.studentmanage.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class CourseController {

    @Autowired
    private CourseService courseService;

    @RequestMapping("courseindex")
    public String list(Model model){
        List<Course> courses = courseService.findAll();
        model.addAttribute("data",courses);
        return "courseindex";
    }

}